import { ListPage } from "custom/index";
import { personalCustomerDataPage } from '../api'
import dayjs from 'dayjs'
import DateSearch from './DateSearch.vue'
import PeceptionPageBefore from './PeceptionPageBefore.vue'
import PeceptionTableBefore from '../custom/PeceptionTableBefore'
const peceptionPageBefore = new PeceptionTableBefore('DataQueryHistoryTableBefore')
peceptionPageBefore.setComponent(PeceptionPageBefore)

const page = new ListPage('DayPage');

page
  .api(personalCustomerDataPage)
  .useSearch()
    .addInputItem('dateStart', '', dayjs().subtract(6, 'month').format('YYYY-MM-DD'))
    .addItem({ prop: 'dateEnd', default: dayjs().format('YYYY-MM-DD') })
    .setComponent(DateSearch)
    .end()
  .useTable()
    .useIndexColumn().end()
    .useColumn('date').label('日期').minWidth(140).end()
    .useColumn('sumSalesRevenue').label('销售额').toFixed(2).minWidth(140).end()
    .useColumn('sumReceptionVolume').label('接待量').toFixed(2).minWidth(140).end()
    .useColumn('averageResponseTime').label('平均响应时间').toFixed(2).minWidth(160).end()
    .useColumn('averageConversionRate').label('平均转化率').toFixedPercent(2).minWidth(140).end()
    .useColumn('averageResponseRate').label('平均回复率').toFixedPercent(2).minWidth(140).end()
    .useColumn('averageQARatio').label('平均问答比').toFixedPercent(2).minWidth(140).end()
    .end()
  .usePagination()
    .end()
  .useAuthButton()
    .useItem('').content('导出数据').end()
    .end()
  .addChild(peceptionPageBefore, 'table-before')

export default page
